home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / jazlib.arc / MEMW.ASM < prev    next >
Assembly Source File  |  1988-12-18  |  1KB  |  52 lines

  1.  
  2. Comment *
  3. ┌────────────────────────────────────────────────────────────────────────────┐
  4. │memw.asm                                     │
  5. │Look at a word of memory, pass it back to c as the function result.         │
  6. │                                         │
  7. │Synopsis: w = memw(0x40,0x17);                          │
  8. └────────────────────────────────────────────────────────────────────────────┘
  9. *
  10.  
  11. ;=============================================================================
  12. ;                    Data
  13. ;=============================================================================
  14.  
  15. DGROUP    group    _DATA
  16. _DATA    segment word public 'DATA'
  17.     assume    ds:DGROUP
  18.  
  19.     ; Your Data goes here . . .
  20.  
  21. _DATA    ends
  22.  
  23. ;=============================================================================
  24. ;                   Code
  25. ;=============================================================================
  26.  
  27.     assume cs:_text
  28. _text    segment public byte 'code'
  29.     PUBLIC _memw
  30.  
  31. _memw        proc near
  32.  
  33.     push bp             ; save base of stack
  34.     mov bp,sp            ; establish stack frame
  35.  
  36.     push ds             ; save data and extra segs
  37.  
  38.     push [bp+4]            ; get segment address
  39.     pop ds
  40.     mov bx,[bp+6]            ; get offset address
  41.     mov ax,[bx]            ; get byte in return parameter
  42.  
  43.     pop ds                ; restore data and extra segs
  44.  
  45.     mov sp,bp            ; restore stack pointer
  46.     pop  bp             ; and base of stack
  47.     ret                ; return to caller
  48.  
  49. _memw        endp
  50. _text    ends
  51. end
  52.